import os
import sys
import platform

OS_NAME = platform.system();
LIB_DIR=os.environ['LIB_DIR'];
BIN_DIR=os.environ['BIN_DIR'];

env=DefaultEnvironment().Clone()
SOURCES=Glob('rlottie/*.c')+ \
  Glob('*.c') + \
  Glob('rlottie_impl/src/lottie/*.cpp') + \
  Glob('rlottie_impl/src/vector/*.cpp') + \
  Glob('rlottie_impl/src/vector/freetype/*.cpp') + \
  Glob('rlottie_impl/src/vector/stb/*.cpp') + \
  Glob('rlottie_impl/src/binding/c/*.cpp') + \
  Glob('rlottie_impl/src/lottie/zip/*.cpp')

EXPORT_DEF=''
if OS_NAME == 'Windows' and os.environ['TOOLS_NAME'] == '':
  EXPORT_DEF = ' /DEF:"src/rlottie.def" '

if 'BUILD_SHARED' in os.environ and os.environ['BUILD_SHARED'] == 'True':
  LIBS=['awtk'];
  LINKFLAGS=env['LINKFLAGS'] + EXPORT_DEF 
  env.SharedLibrary(os.path.join(BIN_DIR, 'rlottie'), SOURCES, LIBS=LIBS, LINKFLAGS=LINKFLAGS);
else:
  env.Library(os.path.join(LIB_DIR, 'rlottie'), SOURCES);

